package com.esri.core.map.popup;

import com.esri.core.internal.util.d;
import com.esri.core.io.EsriServiceException;
import java.io.StringWriter;
import org.codehaus.jackson.JsonGenerator;
import org.codehaus.jackson.JsonParser;
import org.codehaus.jackson.JsonToken;

/* loaded from: classes.dex */
public class PopupFieldInfo {
    String a;
    String b;
    PopupFormatValue c;
    boolean d = true;
    boolean e = false;
    String f;
    String g;

    public String getFieldName() {
        return this.a;
    }

    public void setFieldName(String str) {
        this.a = str;
    }

    public String getLabel() {
        return this.b;
    }

    public void setLabel(String str) {
        this.b = str;
    }

    public PopupFormatValue getFormat() {
        return this.c;
    }

    public void setFormat(PopupFormatValue popupFormatValue) {
        this.c = popupFormatValue;
    }

    public boolean isVisible() {
        return this.d;
    }

    public void setVisible(boolean z) {
        this.d = z;
    }

    public boolean isEditable() {
        return this.e;
    }

    public void setEditable(boolean z) {
        this.e = z;
    }

    public String getTooltip() {
        return this.f;
    }

    public void setTooltip(String str) {
        this.f = str;
    }

    public String toString() {
        return "PopupFieldInfo [fieldName=" + this.a + ", label=" + this.b + ", format=" + this.c + ", visible=" + this.d + ", isEditable=" + this.e + ", tooltip=" + this.f + ", stringFieldOption=" + this.g + "]";
    }

    public static PopupFieldInfo fromJson(JsonParser jsonParser) throws Exception {
        if (!d.c(jsonParser)) {
            throw new EsriServiceException("This response cannot be parsed.");
        }
        PopupFieldInfo popupFieldInfo = new PopupFieldInfo();
        while (jsonParser.nextToken() != JsonToken.END_OBJECT) {
            String currentName = jsonParser.getCurrentName();
            JsonToken nextToken = jsonParser.nextToken();
            if ("fieldName".equals(currentName)) {
                popupFieldInfo.a = jsonParser.getText();
            } else if ("label".equals(currentName)) {
                popupFieldInfo.b = jsonParser.getText();
            } else if ("format".equals(currentName) && !nextToken.equals(JsonToken.VALUE_NULL)) {
                popupFieldInfo.c = PopupFormatValue.fromJson(jsonParser);
            } else if ("visible".equals(currentName)) {
                popupFieldInfo.d = jsonParser.getBooleanValue();
            } else if ("isEditable".equals(currentName)) {
                popupFieldInfo.e = jsonParser.getBooleanValue();
            } else if ("tooltip".equals(currentName)) {
                popupFieldInfo.f = jsonParser.getText();
            } else if ("stringFieldOption".equals(currentName)) {
                popupFieldInfo.g = jsonParser.getText();
            } else {
                jsonParser.skipChildren();
            }
        }
        return popupFieldInfo;
    }

    public String toJson() throws Exception {
        StringWriter stringWriter = new StringWriter();
        JsonGenerator a = d.a(stringWriter);
        a.writeStartObject();
        String str = this.a;
        if (str != null) {
            a.writeStringField("fieldName", str);
        }
        String str2 = this.b;
        if (str2 != null) {
            a.writeStringField("label", str2);
        }
        if (this.c != null) {
            a.writeFieldName("format");
            a.writeRawValue(this.c.toJson());
        }
        a.writeBooleanField("visible", this.d);
        a.writeBooleanField("isEditable", this.e);
        String str3 = this.f;
        if (str3 != null) {
            a.writeStringField("tooltip", str3);
        }
        String str4 = this.g;
        if (str4 != null) {
            a.writeStringField("stringFieldOption", str4);
        }
        a.writeEndObject();
        a.close();
        return stringWriter.toString();
    }
}
